<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="font-awesome-4.5.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="css/selectize.css">
    <link rel="stylesheet" href="css/selectize.bootstrap3.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" type="text/css" href="css/wangEditor.min.css">
    <link rel="stylesheet" href="css/toastr.css">
    <style type="text/css">
    .ng-binding{overflow:hidden;}
    .table>tbody>tr>td{line-height:normal;}
    </style>
</head>
<body>
<?php 
$nav='student';
include_once './view/_top.php';
$nianji='六年级';
if (isset($_GET['nianji'])){
	$_SESSION['studentnj']=$_GET['nianji'];
}
if (isset($_SESSION['studentnj'])){
	$nianji=$_SESSION['studentnj'];
}
?>
<div class="container-fluid content" id="content">
    <!-- ngView:  --><div class="ng-scope"><div class="container-fluid content ng-scope" id="content">
    <div class="sidebar">
        <ul class="nav nav-sidebar">
            <li id="b" class="active"><a href="?c=student">学生信息</a></li>
        </ul>
    </div>
    <div class="main smain">
        <div class="main-cont" style="min-width: 1064px">

            <h4 class="sub-header">筛选</h4>
            <div>
               <a href="?c=login&a=add"><button class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span>添加</button></a>
            </div>
            <div style="width:258px;">
               <select id="nianji" class="form-control">
					      <option value="三年级" <?php if ('三年级' == $nianji){ ?>selected="selected"<?php } ?> >三年级</option>
					      <option value="四年级" <?php if ('四年级' == $nianji){ ?>selected="selected"<?php } ?> >四年级</option>
					      <option value="五年级" <?php if ('五年级' == $nianji){ ?>selected="selected"<?php } ?> >五年级</option>
					      <option value="六年级" <?php if ('六年级' == $nianji){ ?>selected="selected"<?php } ?> >六年级</option>
				</select>
            </div>
            <div style="overflow: hidden">
                <form class="form-inline ng-pristine ng-valid" method="get" action="">
                    <div class="form-group">
                        <input type="text" name="name" value="<?php echo $name; ?>" class="form-control" placeholder="姓名">
                        <input type="hidden" name="c" value="student" >
                    </div>
                    <div class="form-group">
                        <button class="btn btn-default">查询</button>
                    </div>
                     
                </form>
            </div>
             
            <div style="margin-top: 50px">
                <!--<h4 class="total">-->
                <!--<i class="fa fa-calendar-minus-o"></i>总支出<span class="span3">10000.00</span>-->
                <!--</h4>-->


                <div class="hr-line-dashed"></div>
                <table class="table table-striped tables">
                    <tbody>
                    <tr>
                        <th>ID</th>
                        <th>姓名</th>
                        <th>手机号</th>
                        <th>年级</th>
                        <th>区</th>
                        <th>学校</th>
                        <th>分数</th>
                        <th>参与时间</th>
                        <th style="text-align: left">操作</th>
                    </tr>
                    <?php 
                    
                    if ('三年级' == $nianji){
                        $nj=3;
                        
                    }elseif ('四年级' == $nianji){
                        $nj=4;
                        
                    }elseif ('五年级' == $nianji){
                        $nj=5;
                        
                    }else{
                        $nj=6;
                        
                    }
                     
                    
                    if (isset($_GET['p'])) {
                    	$page=$_GET['p'];
                    }else{
                    	$page=1;
                    }
                    $pageSize=10;
                    
                    $sql="select count(id) as count from `ci3`    ";
                    
                    $njList=array(3=>'三年级',4=>'四年级',5=>'五年级',6=>'六年级');
                    
                    $query_count = $this->mysqli->query($sql);
                    $row=$query_count->fetch_array();
                    $total=$row['count'];
                    $total_page=1;
                    if ($total) {
                    	if($total % $pageSize){
                    		$total_page=(int)($total/$pageSize)+1;
                    	}else{
                    		$total_page=($total/$pageSize);
                    	}
                    }
                    $sql="select * from ci3   order by fen desc limit ".($page-1)*$pageSize.", $pageSize ";
 
                    $query = $this->mysqli->query($sql);
                    while ($listUser=$query->fetch_array()){
                        $sql="select * from u3 where openid='".$listUser['openid']."' limit 0,1  ";
                        $queryU = $this->mysqli->query($sql);
                        $list=$queryU->fetch_array();
                   ?>
                    <tr  class="ng-scope">
                        <td class="ng-binding"><?php echo $list['id']; ?></td>
                        <td class="ng-binding"><?php echo $list['name'];?></td>
                        <td class="ng-binding"><?php echo $list['phone'];?></td>
                        <td class="ng-binding"><?php echo $njList[$list['nianji']];?></td>
                        <td class="ng-binding"><?php echo $list['fxqu'];?></td>
                        <td class="ng-binding"><?php echo $list['school'];?></td>
                        <td class="ng-binding"><?php echo $listUser['fen'];;?></td>
                        <td class="ng-binding"><?php echo $listUser['createtime'];?></td>
                        <td style="text-align: left">
                            <a href="?c=student&a=kao&openid=<?php echo $listUser['openid']; ?>"><i class="fa fa-edit"></i>查看考试情况</a>
                         </td>
                          
                    </tr>
                    <?php } ?>

                    </tbody>
                </table>

                <div class="hr-line-dashed"></div>
                <div class="text-right">
                    <ul class="pagination pagination">
                    <?php $pageUrl='?c=student&p='; ?>
                        <?php if($page > 1){ ?>
					    <li><a href="<?php echo $pageUrl,$page-1; ?>">«</a></li>
					    <?php }else{ ?> 
					    <li class="disabled"><a href="javascript:void(0)">«</a></li>
					    <?php } ?>
					    <?php if($page > 2){ ?><li><a href="<?php echo $pageUrl,$page-2; ?>"><?php echo $page-2; ?></a></li><?php } ?>
                        <?php if($page > 1){ ?><li><a href="<?php echo $pageUrl,$page-1; ?>"><?php echo $page-1; ?></a></li><?php } ?>
                        <li class="active"><a href="<?php echo $pageUrl,$page; ?>"><?php echo $page; ?></a></li>
                        <?php if(($page+1) <= $total_page){ ?><li><a href="<?php echo $pageUrl,$page+1; ?>" ><?php echo $page+1; ?></a></li><?php } ?>
                        <?php if(($page+2) <= $total_page){ ?><li><a href="<?php echo $pageUrl,$page+2; ?>" ><?php echo $page+2; ?></a></li><?php } ?>
                         
                        <?php if(($page+1) <= $total_page){ ?><li class="disabled"><a href="<?php echo $pageUrl,$page+1; ?>">»</a></li><?php }else{ ?>
                            <li class="disabled"><a href="javascript:void(0)">»</a></li>
                        <?php } ?> 
                         
                    </ul>
                </div>
            </div>
        </div>
    </div>



</div>

 
<div class="modal fade ng-scope" id="mymodal3">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                <h4>提示</h4>
            </div>
            <div class="modal-body">
                <p>一旦删除不可恢复，是否确认</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-success delyes" data-dismiss="modal">确认</button>
            </div>
        </div>
    </div>
</div>
 
</div>
</div>

<script src="js/jquery-2.2.4.min.js"></script>
<script src="js/toastr.js"></script>
<script src="js/easing.js"></script>
<script src="js/selectize.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/wangEditor.js"></script>
<script src="js/TileHeadPic.js"></script>
<script src="js/calendar.js"></script>
<script type="text/javascript">
$(function(){
	var _id=0;
	$(".delbtn").click(function(){
		_id=$(this).attr("data-id");
		$('#mymodal3').modal('show');
	});
	$(".delyes").click(function(){
		 window.location.href="?name=<?php echo $name; ?>&a=home&id="+_id;
	});

	$("#nianji").change(function(){
		var _nianji=$(this).val();
		 window.location.href="?c=student&nianji="+_nianji;
	});
	
	
});
</script>
</body></html>